Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Dan 65 posts 209 karma points
    Apr 10, 2014 @ 09:47
    Dan
    0

    uQuery compare Property value with all sting[] list items

    Im trying to get a node by type where one or more categories is choosen on the node. This method is used by calling the api from ajax.

    public IList<object> getAllFromCriteria(string categories)
        {
            List<object> resultList = new List<object>();
             try
            {
                string[] categoryList = categories.Split(',');
                List<umbraco.NodeFactory.Node> nodes = uQuery.GetNodesByType("TYPE").Where(x => categoryList.Any(x.GetProperty("PROPERTYALIAS").Value.ToString().Contains)).ToList();
                InServiceFunctions isFunc = new InServiceFunctions();
                resultList = isFunc.MakeListWithObject(nodes);
            }
            catch (Exception e)
            {
                 object error = new { error = e };
                 resultList.Add(error);
            }
            return resultList;
        }
    

    This always return an error at the line where i try to get the nodes. I have tryed alot of diffrend things here but can't find a solution does anyone know a way to check if string[] list items contains in node property value.

    And the property is populated with a Umbraco.MultiNodeTreePicker if this make any different

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Apr 11, 2014 @ 09:36
    Jeavon Leopold
    0

    Hi Dan,

    Ok so to confirm, you want to get a collection of nodes filtered by checking a multinode tree picker to see a certain node is within that picker?

    And you are using Umbraco 7 MVC?

    Jeavon

Please Sign in or register to post replies

Write your reply to:

Draft